// Author: Bjorn Schobben

#ifndef CAMERA_H
#define CAMERA_H

#include "Vector.h"
#include "World.h"

class Camera
{
public:
	Camera();
	virtual ~Camera();

	void SetTurnSpeed(const Scalar& newTurnSpeed);
	void SetMoveSpeed(const Scalar& newMoveSpeed);

	void MoveForward();
	void MoveBackward();
	void MoveForward(const Scalar& ratio);
	void MoveBackward(const Scalar& ratio);
	void MoveLeft();
	void MoveRight();
	void TurnLeft();
	void TurnRight();
	void TurnLeft(const Scalar& ratio);
	void TurnRight(const Scalar& ratio);

	void SetWorld(const World& newWorld);

	const Vector& GetEyepoint() const;
	const Vector& GetDirection() const;
	const Vector& GetCameraPlane() const;

private:
	void ClampAngle();
	void RotatePlanes();
	void CheckCollision(Vector test);

	Vector eyepoint;
	Vector direction;
	Vector cameraPlane;
	Scalar angle;
	Scalar turnSpeed;
	Scalar moveSpeed;
	const World* world;

	static const Scalar DEFAULT_MOVESPEED;
	static const Scalar DEFAULT_TURNSPEED;
	static const Vector DEFAULT_CAMERAPLANE;
	static const Vector DEFAULT_DIRECTION;
	static const Vector DEFAULT_EYEPOINT;
};

#endif // CAMERA_H
